package com.hd.crdao.adapter;

import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.hd.crdao.R;
import com.hd.crdao.base.MyBaseAdapter;
import com.hd.crdao.bean.AreaListBean;
import com.hd.crdao.utils.UIUtils;

import java.util.List;

/**
 *
 *@author Administrator
 *@date 2017/5/31 0031
 */
public class AreaListAdapter extends MyBaseAdapter<AreaListBean.ListAreaBean> {

    public AreaListAdapter(List<AreaListBean.ListAreaBean> dataSets) {
        super(dataSets);
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        AreaListAdapter.ViewHolder viewHolder;
        AreaListBean.ListAreaBean listAreaBean = mDataSets.get(position);
        if(convertView ==null){
            viewHolder = new ViewHolder();
            convertView = View.inflate(UIUtils.getContext(), R.layout.item_city,null);
            viewHolder.area = (TextView) convertView.findViewById(R.id.area);
            convertView.setTag(viewHolder);
        }else {
            viewHolder = (ViewHolder) convertView.getTag();
        }
            viewHolder.area.setText(listAreaBean.getName());
        return convertView;
    }

    final static class ViewHolder {
        TextView area;
    }
}
